package org.goodsl.mdd.validator;

import org.goodsl.mdd.Seg;
import org.goodsl.mdd.SingleValidResult;
import org.goodsl.mdd.Validator;

/**
 * Created with IntelliJ IDEA.
 * User: Simon Xiao
 * Date: 12-11-12
 * Time: 下午3:55
 * To change this template use File | Settings | File Templates.
 */
public class MinValidator extends Validator<Seg> {

    public Object min;

    public MinValidator(Object minValue, String message){
        super(message);
        this.min = minValue;
    }

    @Override
    public SingleValidResult<Seg> verify(Seg variable) {
        if(variable.compareTo(min)>=0){
            return new SingleValidResult<Seg>(true,"",variable,this);
        }
        return new SingleValidResult<Seg>(false,getMessage(),variable,this);
    }
}
